package com.atguigu.springcloud.service;

import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName PaymentService
 * @Author VCR
 * @Date 2021/12/25 22:14
 * @Version 1.0
 */
@Service
public class PaymentService {
    /**
     * 正常访问 ok
     * @param id
     * @return
     */
    public String paymentInfoOK(Integer id) {
        return "线程池："+Thread.currentThread().getName()+"   paymentInfo_OK,id：  "+id+"\t"+"avCoder(*^▽^*)";
    }

    // 失败
    public String paymentInfoTimeOut(Integer id){
        int timeNumber = 3;
        try {
            TimeUnit.SECONDS.sleep(timeNumber);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "线程池："+Thread.currentThread().getName()+"   paymentInfo_TimeOut,id:  "+id+"\t"+"呜呜┭┮﹏┭┮"+" 耗时:"+timeNumber+"秒";
    }


}
